#pragma once

#include "public/build.h"
#include "client/iwindow.h"
#include "graphics/idevice.h"

#include <Windows.h>
#include <functional>

namespace renderit {
	namespace client {

		class window : public iwindow
		{
		public:
			window();
			~window();

		public:
			virtual void * get_handle() const override { return wnd_; }
			virtual uint32 get_width() const override { return width_; }
			virtual uint32 get_height() const override { return height_; }

			const std::string& get_title() const { return title_; }

			void show(bool b);
			bool loop();

		public:
			static window * create(uint32 width, uint32 height, const std::string& title);

			static LRESULT CALLBACK wnd_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam);

		private:
			static BOOL register_class();
			static HWND create_window(uint32 width, uint32 height, const std::string& title);

		private:
			HWND wnd_;
			uint32 width_;
			uint32 height_;
			std::string title_;

			graphics::idevice * device_;
		};
	}
} // namespace renderit